package com.chendx.store.comment.controller;

import com.chendx.model.common.dtos.ResponseResult;
import com.chendx.store.api.comment.FileControllerApi;
import com.chendx.store.comment.service.GoodsCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * Created by chendx on 2022/5/13.
 */
@RestController
@RequestMapping("/api/file")
public class FileController implements FileControllerApi {


    @Autowired
    private GoodsCommentService goodsCommentService;

    @Override
    @PostMapping("/upload")
    public ResponseResult uploadImg(@RequestParam("imgFile") MultipartFile imgFile) {
        return goodsCommentService.upload(imgFile);
    }

    @Override
    @GetMapping("/handleRemove")
    public ResponseResult handleRemove(String filePath) {
        return goodsCommentService.handleRemove(filePath);
    }

    @Override
    @GetMapping("/handlesRemove")
    public ResponseResult handlesRemove(String filePaths) {
        return goodsCommentService.handlesRemove(filePaths);
    }
}
